package com.tuling.sevice;

import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.type.AnnotatedTypeMetadata;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;

/**
 * @Type UserService.java
 * @Desc
 * @Author wzw
 * @Date 2024/8/11 12:39
 */

@Component
@EnableTransactionManagement
public class UserService implements Condition {
	@Transactional
	public void userInfo(){
		System.out.println("userInfowwwwwwwww");
	}

	@Override
	public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
		try {
			Class<?> aClass = context.getClassLoader().loadClass("com.tuling.user");
			return true;
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			return false;
		}
	}
}
